{% set pypi_name = 'os-vif' %}
{% set upstream_version = upstream_version('2.3.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        A library for plugging and unplugging virtual interfaces in OpenStack
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        https://files.pythonhosted.org/packages/source/o/os-vif/os_vif-%{version}.tar.gz
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('devel') }}
BuildRequires:  {{ py3('netaddr') }}
BuildRequires:  {{ py3('oslo.concurrency') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.privsep') }}
BuildRequires:  {{ py3('oslo.versionedobjects') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('ovsdbapp') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pyroute2') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('testrepository') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
A library for plugging and unplugging virtual interfaces in OpenStack.
Features:
* A base VIF plugin class that supplies a plug() and unplug() interface
* Versioned objects that represent a virtual interface and its components

%package -n python3-os-vif
Summary:        A library for plugging and unplugging virtual interfaces in OpenStack
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('netaddr') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.privsep') }}
Requires:       {{ py3('oslo.versionedobjects') }}
Requires:       {{ py3('ovsdbapp') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('pyroute2') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}

%description -n python3-os-vif
A library for plugging and unplugging virtual interfaces in OpenStack.
Features:
* A base VIF plugin class that supplies a plug() and unplug() interface
* Versioned objects that represent a virtual interface and its components

This package contains the Python 3.x module.

%package -n python-os-vif-doc
Summary:        Documentation for a library for plugging and unplugging virtual interfaces in OpenStack
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('reno') }}

%description -n python-os-vif-doc
Documentation for a library for plugging and unplugging virtual interfaces
in OpenStack.

%prep
%autosetup -p1 -n os_vif-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

# generate html docs
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
export OS_TEST_PATH="os_vif/tests/unit"
python3 -m stestr.cli run

%files -n python3-os-vif
%license LICENSE
%doc README.rst ChangeLog
%{python3_sitelib}/os_vif
%{python3_sitelib}/vif_plug_ovs
%{python3_sitelib}/vif_plug_linux_bridge
%{python3_sitelib}/vif_plug_noop
%{python3_sitelib}/*.egg-info

%files -n python-os-vif-doc
%license LICENSE
%doc doc/build/html

%changelog
